package com.lt.bcra.exception;

import com.lt.bcra.result.ResponseEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class BaseException extends RuntimeException{
    private static final long serialVersionUID = 1L;
    private Integer code;
    private String message;

    /**
     *
     * @param code
     * @param message
     * @param cause 原始的异常对象
     */
    public BaseException(Integer code,String message,Throwable cause){
        super(cause);
        this.code=code;
        this.message=message;
    }

    public BaseException(ResponseEnum responseEnum, Throwable cause){
        super(cause);
        this.code=responseEnum.getCode();
        this.message=responseEnum.getMessage();
    }

    public BaseException(ResponseEnum responseEnum){
        this.code=responseEnum.getCode();
        this.message=responseEnum.getMessage();
    }
}
